package logic

import (
	"context"
	"week1/textrpc/models"
	"week1/textrpc/service"

	"week1/textrpc/internal/svc"
	"week1/textrpc/textrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CreateJvBaoLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCreateJvBaoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateJvBaoLogic {
	return &CreateJvBaoLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CreateJvBaoLogic) CreateJvBao(in *textrpc.CreateJvBaoReq) (*textrpc.CreateJvBaoRes, error) {
	// todo: add your logic here and delete this line
	err := service.CreateJvBao(&models.JvBao{
		TextId:  in.TextId,
		Userid:  in.Userid,
		Comment: in.Comment,
		Status:  0,
	})
	if err != nil {
		return &textrpc.CreateJvBaoRes{}, err
	}
	return &textrpc.CreateJvBaoRes{}, nil
}
